//封装登录请求接口的请求调用的函数（loginApi）

//先导入封装的统一调用函数和参数/返回的数据类型
import { get, post, put,del } from './request'


//登录接口的请求函数      参数名：参数值
export const loginApi = (data: any) => {
  return post<any>('mgr/login', data)
}

//注册接口的请求函数        参数名：参数值
export const registerApi = (data: any) => {
  return post<any>('mgr/register', data)
}

//手机号查询接口的请求函数
export const queryPhoneApi = (data: any) => {
  return get<any>('mgr/getByPhone', data)
}

//获取验证码接口的请求函数
export const getCodeApi = (data: any) => {
  return get<any>('mgr/sms', data)
}
//修改密码接口的请求函数
export const UpdateApi = (data: any) => {
  return post<any>('mgr/updatePwd', data)
}




/* 权限管理接口的请求函数 */

//addMenuApi, delteteMenuApi, getMenuListApi, updateMenuApi
//获取该角色所有权限
export const permissionListApi = (data: any) => {
  return post<any>('permission/getByPage', data)
}

//获取菜单列表
export const getMenuListApi = (data?: any) => {
  return get<any>('permission/getMenuList', data)
}

//删除权限接口的请求函数
export const deletePermissionApi = (data: any) => {
  return del<any>('permission/delete?id='+ data)
}

//添加权限接口的请求函数
export const addPermissionApi = (data: any) => {
  return post<any>('permission/add', data)
}

//修改权限接口的请求函数
export const updatePermissionApi = (data: any) => {
  return put<any>('permission/update', data)
}




/*    角色管理接口      */
//角色所有列表
export const roleAllListApi = () => {
  return get<any>('role/getAllList')
}
//角色列表
export const roleListApi = () => {
  return get<any>('role/list')
}

//获取当前角色已分配的按钮、权限、权限
export const getDataByRoleApi = (data: any) => {
  return get<any>('role/getByRole', data)
}


//角色删除
export const deleteRoleApi = (data: any) => {
  return del<any>('role/delete?id='+ data)
}

//角色添加
export const addRoleApi = (data: any) => {
  return post<any>('role/add', data)
}


//角色分配权限
export const reallocatePermApi = (data: any) => {
  return post<any>('role/reallocatePerm', data)
}






/*  方向管理接口  */
//方向列表
export const getMajorStatisticsApi = (data: any) => {
  return get<any>('major/getMajorStatistics', data)
}


//添加方向
export const addMajorApi = (data: any) => {
  return post<any>('major/add', data)
}
//修改方向
export const updateMajorApi = (data: any) => {
  return put<any>('major/update', data)
}
//删除方向
export const deleteMajorApi = (data: any) => {
  return del<any>('major/delete?id='+ data)
}
//方向列表
export const getMajorListApi = () => {
  return get<any>('major/list')
}


//添加方向
export const addStaffApi = (data: any) => {
  return post<any>('staff/add', data)
}
//修改员工
export const updateStaffApi = (data: any) => {
  return put<any>('staff/update', data)
}
//删除员工
export const deleteStaffApi = (data: any) => {
  return del<any>('staff/delete?id='+ data)
}
//员工列表
export const getStaffListApi = (data: any) => {
  return post<any>('staff/getByPage', data)
}
//查询员工联系方式
export const queryContactApi = (data?: any) => {
  return get<any>('staff/queryContact', data)
}